package com.dfrz.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.time.LocalDate;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Component
@TableName("video")
public class Video{
    @TableId(value ="video_id",type = IdType.AUTO)       //自动增长（mybatis-plus使用）
    private  Integer videoId;                 //视频id
    private  String videoTitle;           //视频标题
    private  String videoIntro;           //简介
    private  String videoTime;              //发行时间
    private  String videoUrl;             //视频封面图片存储地址
    private  Integer userId;
    private  String videoMold;            //视频类型 番剧，热血，玄幻等
    private  Double score;
    private  String upTime;               //更新时间

    @TableField(exist = false)
    private VideoDetail detail;
    @TableField(exist = false)
    private User user;
    //管理员发布视频构造器
    public Video(String videoTitle, String videoIntro, String videoTime, Integer userId, String videoMold, String upTime) {
        this.videoTitle = videoTitle;
        this.videoIntro = videoIntro;
        this.videoTime = videoTime;
        this.userId = userId;
        this.videoMold = videoMold;
        this.upTime = upTime;
    }


    //普通用户发布视频构造器
    public Video(String videoTitle, String videoIntro, String date, Integer userId) {
        this.videoTitle = videoTitle;
        this.videoIntro = videoIntro;
        this.videoTime = date;
        this.userId = userId;
    }


//    视频更新
    public Video(Integer videoId, String videoTitle, String videoIntro, String videoTime, Integer userId, String videoMold, String upTime) {
        this.videoId = videoId;
        this.videoTitle = videoTitle;
        this.videoIntro = videoIntro;
        this.videoTime = videoTime;
        this.userId = userId;
        this.videoMold = videoMold;
        this.upTime = upTime;
    }
}
